<template>
  <div>
    <video id="videoElement" controls autoplay muted width="300px" height="200px">
    </video>
    <button @click="play">播放</button>
  </div>
</template>

<script>
import flvjs from 'flv.js'
export default {
  name: "demo",
  data () {
    return {
      flvPlayer:null
    }
  },
  mounted() {
    if (flvjs.isSupported()) {
      var videoElement = document.getElementById('videoElement');
      this.flvPlayer = flvjs.createPlayer({
        type: 'mp4',
        isLive: true,
        hasAudio: false,
        url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
      });
      this.flvPlayer.attachMediaElement(videoElement);
      this.flvPlayer.load();
      this.flvPlayer.play();
    }
  },
  methods: {
    play() {
      this.flvPlayer.play();
    }
  }
}
</script>

<style scoped>
</style>